package com.mes.controller.manu;

import com.mes.service.manu.TypesettingService;
import com.yy.base.common.action.BaseCtrl;
import com.yy.base.page.Message;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("typesettingController")
public class TypesettingController extends BaseCtrl {
	@Autowired
	private TypesettingService service;


	//获取排版历史记录
	@ResponseBody
	@RequestMapping(value="getJobPaibanList", method=RequestMethod.POST)
	public Message getJobPaibanList(HttpServletRequest request) {
		Message msg = new Message();
		try {
			String colorId = request.getParameter("colorId");
			String product = request.getParameter("product");

			List<Map<String, Object>> data = service.getJobPaibanList( product, colorId);

			if (data == null || data.isEmpty()) {
				msg.setErrorMessage("当前无生产信息！");
			} else {
				msg.setData("code", 0);
				msg.setData("data", data);
			}
		} catch (Exception e) {
			e.printStackTrace();
			msg.setErrorMessage("查询异常：" + e.getMessage());
		}
		return msg;
	}
}